@model IEnumerable<WorkFlowCore.BusinessDemo.Web.Models.OrganizationIndexViewModel>

@{
    ViewData["Title"] = "组织管理";
}

<div class="card">
    <div class="card-header">
        <h3 class="card-title">组织列表</h3>
        <div class="card-tools">
            <a asp-action="Create" class="btn btn-primary">新增组织</a>
        </div>
    </div>
<div class="card-body">
        @if (TempData["ErrorMessage"] != null)
        {
            <div class="alert alert-danger">@TempData["ErrorMessage"]</div>
        }
        @if (TempData["SuccessMessage"] != null)
        {
            <div class="alert alert-success">@TempData["SuccessMessage"]</div>
        }
        <ul id="orgTree" class="list-group">
            @foreach (var org in Model)
            {
                <partial name="_OrganizationNode" model="org" />
            }
        </ul>
    </div>
</div>

@section Scripts {
    <script>
        $(function () {
            $('#orgTree').treeview({
                expandIcon: 'fas fa-plus',
                collapseIcon: 'fas fa-minus',
                nodeIcon: 'fas fa-sitemap',
                showBorder: false,
                levels: 5
            });
        });
    </script>
}
